package com.tt.vtg.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.tt.vtg.dao.RoleDao;
import com.tt.vtg.dao.entity.Role;
import com.tt.vtg.service.RoleService;

@Component("roleSvc")
@Transactional(value = "txManager")
public class RoleServiceImpl implements RoleService {
	@Autowired
	private RoleDao roleDao;

	@Override
	public Role get(Long id) {
		return roleDao.findOne(id);
	}

	@Override
	public void save(Role t) {
		roleDao.save(t);
	}

	@Override
	public void update(Role t) {
		roleDao.saveAndFlush(t);
	}

	@Override
	public Role getById(String roleId) {
		return roleDao.findByRoleId(roleId);
	}

	@Override
	public void delete(long id) {
		roleDao.delete(id);
	}

	@Override
	public List<Role> getAll() {
		return roleDao.findAll();
	}

}
